// 用|分割每个属性，逗号前面为属性名,逗号后面为属性值。请写一个函数实现根据属性名查询对应值

var data = {
    rest: "antd,change|csfsdfds,dflsls|change,ancete|parents,2|id,3"
}
function search(params) {
    let obj = new Object();
    for (const item of (data.rest).split('|')) {
        obj[item.split(',')[0]] = item.split(',')[1]
    }
    return obj[params]
}
console.log(search('csfsdfds'));